package com.example.demo.dao;

import com.example.demo.bean.Department;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 *
 * @author ouyangzhixiang
 * @date 2018/6/22
 */
public interface DepartmentRepository extends JpaRepository<Department, Integer> {
    /**
     * 通过父节点id查找对应部门，通过主键方式进行降序排列，从大到小
     * 方法不添加Desc字段代表默认升序排列从小到大
     *
     * @param parentId 父节点Id
     * @return
     */
    List<Department> findByParentIdOrderByIdDesc(Integer parentId);
}
